<style type="text/css">
div.pic img {
  cursor:url(/images/big.cur), auto!important;
}

a.joke { color: #555; }
a.joke:hover { color: #ff0000; }

/** 视频 **/
#video { margin: 15px 20px; }
#updown { clear:both; padding: 5px; background: #CCFFFF;}

/** 同类型笑话 **/
#catePosts h4 { margin: 5px 0px; padding-top: 10px; }
#catePosts ul { list-style: none; clear: both; }
#catePosts ul li { float: left; margin-right: 20px; }

/** 随机图片 **/
#picPosts h4 { margin: 5px 0px; padding-top: 10px; }
#picPosts ul { list-style: none; clear: both; }
#picPosts ul li { float: left; background-color: #f7f7f7; 
  padding-bottom: 5px; margin-right: 10px; text-align:center; }
#picPosts ul li img { padding: 0px; border: 0px; }

.clear { clear: both; }
</style>
<h1><%=@post.title%></h1>

<div class="item">
  <div class="title">
    <span class="pubdate">发布日期：<%=@post.postdate.in_time_zone(+8.hours).strftime('%Y年%m月%d日 %H:%M') %></span>&nbsp;
    <span class="tag">类别：<a href="/<%=Common.getCateUrlName @post.cateid %>/"><%=Common.getCateName @post.cateid%></a></span>
  </div>
  <% if(@post.content != nil && @post.content.size > 5) %>
  <div class="text"><%=raw(@post.content)%></div>
  <% end %>
  <% if(@post.pic != nil && @post.pic.size > 5) %>
    <% (@post.pic.split('|')).each do |pic| %><div class="pic"><img alt="<%=@post.title%>" src="<%=mediumPic pic%>" border="0" /></div><% end %>
  <% end %>

  <% if(@post.video != nil && @post.video.size > 5) %>
  <div id="video"><embed src="<%=Common.getVideoUrl @post.video%>" allowFullScreen="true" quality="high" width="480" height="400" align="middle" allowScriptAccess="always" type="application/x-shockwave-flash"></embed></div>
  <% end %>

  <% if((@post.pic == nil || @post.pic.size < 5) && (@post.video == nil || @post.video.size < 5))%>
  <div id="ad">
    <script type="text/javascript">var yibo_id="20790";</script><script src="http://yibo.iyiyun.com/yibo.js" type="text/javascript"></script>
  </div>
  <% end %>

<!-- Baidu Button BEGIN -->
<div id="bdshare" class="bdshare_t bds_tools get-codes-bdshare">
<span class="bds_more">分享到：</span>
<a class="bds_tsina">新浪微博</a>
<a class="bds_qzone">QQ空间</a>
<a class="bds_tqq">腾讯微博</a>
<a class="bds_renren">人人网</a>
<a class="bds_t163">网易微博</a>
<a class="bds_douban">豆瓣网</a>
<a class="shareCount"></a>
</div>
<script type="text/javascript" id="bdshare_js" data="type=tools&amp;uid=6540433" ></script>
<script type="text/javascript" id="bdshell_js"></script>
<script type="text/javascript">
document.getElementById("bdshell_js").src = "http://bdimg.share.baidu.com/static/js/shell_v2.js?cdnversion=" + Math.ceil(new Date()/3600000);
</script>
<!-- Baidu Button END -->

  <br/><br/>
  <div id="updown">
    <span style="float:left;" name="pre">上一篇：<%=raw prenext @post_pre%></span>
    <span style="float:right;" name="next">下一篇：<%=raw prenext @post_next%></span>
    <div style="clear:both; color:#555; font-size:12px; padding:3px 0px;">
      <img src="/images/light_bulb.png" align="absmiddle" />温馨小提示：按下键盘上的左右方向键，可以上下翻页。</div>
  </div>

  <div id="catePosts">
    <h4>您可能也喜欢以下同类型笑话：</h4>
    <ul>
    <% @CatePosts.each do |post| %>
      <li><a class="joke" href="/detail/<%=post.id%>.html"><%=post.title%></a></li>
    <% end %>
  </ul>
  </div>
  <div class='clear'></div> 

  <div id="picPosts">
    <h4>更多精彩笑话，请请点击下列图片：</h4>
    <ul>
    <% @PicPosts.each do |post| %>
      <li><a class="joke" href="/detail/<%=post.id%>.html"><img src="<%=thumbPic post.pic%>" alt="<%=post.title%>"/><br/><%=post.title%></a>
      </li>
    <% end %>
    </ul>
  </div>
  <div class='clear'></div> 

</div>

<div id="side-pannel">
  <a href="#" title="返回顶部"><div class="top"></div></a>
  <a href="#" title="用户反馈"><div class="feedback"></div></a>
</div>
<div class='clearfix'></div> 

<script type="text/javascript">
$().ready(function(){
  $('div.pic img').click(function(){ 
    var current = this.src;
    if(current.indexOf('/medium/') > 1) {
      current = current.replace('/medium/', '/original/');
    } else {
      current = current.replace('/original/', '/medium/');
    }
    this.src = current;
  });

  // 翻页快捷键
  $(document).keyup(function(evt){
    var _leftCode = 37;
    var _rightCode = 39;
    if(evt.keyCode == _leftCode) {
      var mylink = $('#updown span[name=pre] a');
      if(mylink.length == 1) mylink.get(0).click();
    } else if(evt.keyCode == _rightCode) {
      var mylink = $('#updown span[name=next] a');
      if(mylink.length == 1) mylink.get(0).click();
    }
  });
});
</script>